home *** CD-ROM | disk | FTP | other *** search
/ Internet Pratica / IPRAT_01.iso / ASP / ASPapp Portal / admin_links.asp < prev    next >
Encoding:
Text File  |  2002-03-12  |  22.9 KB  |  703 lines

  1. <!-- #include file="i_utils.asp" -->
  2. <%
  3.  
  4. check_security(2) 
  5.  
  6. %>
  7. <%
  8.     dim Ratings
  9.     dim LinkID
  10.     dim CatID
  11.     dim DateAdded
  12.     dim LinkTypeID
  13.     dim Title
  14.     dim URL
  15.     dim DownloadURL
  16.     dim DownloadFee
  17.     dim Description
  18.     dim Email
  19.     dim Priority
  20.     dim Impressions
  21.     dim ClickThrus
  22.     dim AvgRating
  23.     dim Display
  24.     dim edit_links_sql
  25.     dim Cat
  26.     dim Site
  27.     dim Send
  28.     dim view_links_sql
  29.  
  30. sub request_edit_links
  31. ''' request expected input parameters for this form
  32.     Ratings = request("Ratings")
  33.     LinkID = request("LinkID")
  34.     CatID = request("CatID")
  35.     DateAdded = request("DateAdded")
  36.     LinkTypeID = request("LinkTypeID")
  37.     Title = request("Title")
  38.     URL = request("URL")
  39.     DownloadURL = request("DownloadURL")
  40.     DownloadFee = request("DownloadFee")
  41.     Description = request("Description")
  42.     Email = request("Email")
  43.     Priority = request("Priority")
  44.     Impressions = request("Impressions")
  45.     ClickThrus = request("ClickThrus")
  46.     AvgRating = request("AvgRating")
  47.     Display = request("Display")
  48. end sub
  49. sub request_view_links
  50. ''' request expected input parameters for this form
  51.     Email = request("Email")
  52.     LinkID = request("LinkID")
  53.     URL = request("URL")
  54.     Display = request("Display")
  55.     Title = request("Title")
  56.     Cat = request("Cat")
  57.     Site = request("Site")
  58.     Send = request("Send")
  59.     Description = request("Description")
  60.     DateAdded = request("DateAdded")
  61.     Priority = request("Priority")
  62.     AvgRating = request("AvgRating")
  63.     ClickThrus = request("ClickThrus")
  64.     Impressions = request("Impressions")
  65. end sub
  66.  
  67. sub validate_edit_links
  68. ''' request and validate data entered from this form
  69.     Ratings = trim(request("Ratings"))
  70.     LinkID = trim(request("LinkID"))
  71.     CatID = trim(request("CatID"))
  72.     if CatID = "" then
  73.         error_list.add "484444","Category must be specified."
  74.         b_error = true
  75.     end if
  76.     DateAdded = trim(request("DateAdded"))
  77.     if DateAdded <> "" AND (not isdate(DateAdded)) then
  78.         error_list.add "484446date","Added must be a valid date (MM/DD/YY)."
  79.         b_error = true
  80.     end if
  81.     LinkTypeID = trim(request("LinkTypeID"))
  82.     if LinkTypeID = "" then
  83.         error_list.add "484453","Link Type <A href='admin_linktypes.asp'>?</A> must be specified."
  84.         b_error = true
  85.     end if
  86.     Title = trim(request("Title"))
  87.     if Title = "" then
  88.         error_list.add "484456","Title must be specified."
  89.         b_error = true
  90.     end if
  91.     URL = trim(request("URL"))
  92.     if URL = "" then
  93.         error_list.add "484457","URL must be specified."
  94.         b_error = true
  95.     end if
  96.     DownloadURL = trim(request("DownloadURL"))
  97.     DownloadFee = trim(request("DownloadFee"))
  98.     Description = trim(request("Description"))
  99.     Email = trim(request("Email"))
  100.     Priority = trim(request("Priority"))
  101.     Impressions = trim(request("Impressions"))
  102.     ClickThrus = trim(request("ClickThrus"))
  103.     AvgRating = trim(request("AvgRating"))
  104.     Display = trim(request("Display"))
  105. end sub
  106. sub validate_view_links
  107. ''' request and validate data entered from this form
  108.     Email = trim(request("Email"))
  109.     LinkID = trim(request("LinkID"))
  110.     URL = trim(request("URL"))
  111.     Display = trim(request("Display"))
  112.     Title = trim(request("Title"))
  113.     Cat = trim(request("Cat"))
  114.     Site = trim(request("Site"))
  115.     Send = trim(request("Send"))
  116.     Description = trim(request("Description"))
  117.     DateAdded = trim(request("DateAdded"))
  118.     if DateAdded <> "" AND (not isdate(DateAdded)) then
  119.         error_list.add "484462date","Added must be a valid date (MM/DD/YY)."
  120.         b_error = true
  121.     end if
  122.     Priority = trim(request("Priority"))
  123.     AvgRating = trim(request("AvgRating"))
  124.     ClickThrus = trim(request("ClickThrus"))
  125.     Impressions = trim(request("Impressions"))
  126. end sub
  127.  
  128. sub get_defaults_edit_links
  129. ''' set default values for this form
  130.     Ratings = 1
  131.     DateAdded = "" & now() & ""
  132. end sub
  133. sub get_defaults_view_links
  134. ''' set default values for this form
  135.     Display = 1
  136. end sub
  137.  
  138. sub db_select_edit_Links
  139.     sql = "SELECT " & _ 
  140.     "Ratings, " & _ 
  141.     "LinkID, " & _ 
  142.     "CatID, " & _ 
  143.     "DateAdded, " & _ 
  144.     "LinkTypeID, " & _ 
  145.     "Title, " & _ 
  146.     "URL, " & _ 
  147.     "DownloadURL, " & _ 
  148.     "DownloadFee, " & _ 
  149.     "Description, " & _ 
  150.     "Email, " & _ 
  151.     "Priority, " & _ 
  152.     "Impressions, " & _ 
  153.     "ClickThrus, " & _ 
  154.     "AvgRating, " & _ 
  155.     "Display FROM Links" & _ 
  156.     " WHERE " & _ 
  157.     "Links.LinkID = " & to_sql(LinkID,"number") & ""
  158.     on error resume next
  159.     set rs = cn.Execute(sql)
  160.     if err.number <> 0 then
  161.         b_error = true
  162.         error_list.add "select_data_edit_Links", "The data selection failed. " & err.description
  163.     elseif rs.EOF then
  164.         b_results = false
  165.         msg_list.add "select_data_edit_Links", "The record was removed from the database."
  166.     else
  167.         Ratings = rs("Ratings")
  168.         LinkID = rs("LinkID")
  169.         CatID = rs("CatID")
  170.         DateAdded = rs("DateAdded")
  171.         LinkTypeID = rs("LinkTypeID")
  172.         Title = rs("Title")
  173.         URL = rs("URL")
  174.         DownloadURL = rs("DownloadURL")
  175.         DownloadFee = rs("DownloadFee")
  176.         Description = rs("Description")
  177.         Email = rs("Email")
  178.         Priority = rs("Priority")
  179.         Impressions = rs("Impressions")
  180.         ClickThrus = rs("ClickThrus")
  181.         AvgRating = rs("AvgRating")
  182.         Display = rs("Display")
  183.     end if
  184.     rs.Close
  185.     on error goto 0
  186. end sub
  187. sub db_insert_edit_Links
  188.     sql = "INSERT INTO Links" & _ 
  189.     "(" & _ 
  190.     "Ratings," & _ 
  191.     "CatID," & _ 
  192.     "DateAdded," & _ 
  193.     "LinkTypeID," & _ 
  194.     "Title," & _ 
  195.     "URL," & _ 
  196.     "DownloadURL," & _ 
  197.     "DownloadFee," & _ 
  198.     "Description," & _ 
  199.     "Email," & _ 
  200.     "Priority," & _ 
  201.     "Impressions," & _ 
  202.     "ClickThrus," & _ 
  203.     "AvgRating," & _ 
  204.     "Display" & _ 
  205.     ") VALUES (" & to_sql(Ratings,"number") & "," & _ 
  206.     "" & to_sql(CatID,"number") & "," & _ 
  207.     "" & to_sql(DateAdded,"text") & "," & _ 
  208.     "" & to_sql(LinkTypeID,"number") & "," & _ 
  209.     "" & to_sql(Title,"text") & "," & _ 
  210.     "" & to_sql(URL,"text") & "," & _ 
  211.     "" & to_sql(DownloadURL,"text") & "," & _ 
  212.     "" & to_sql(DownloadFee,"text") & "," & _ 
  213.     "" & to_sql(Description,"text") & "," & _ 
  214.     "" & to_sql(Email,"text") & "," & _ 
  215.     "" & to_sql(Priority,"number") & "," & _ 
  216.     "" & to_sql(Impressions,"number") & "," & _ 
  217.     "" & to_sql(ClickThrus,"number") & "," & _ 
  218.     "" & to_sql(AvgRating,"text") & "," & _ 
  219.     "" & to_sql(Display,"number") & ")" & _ 
  220.     ""
  221.     'response.write sql
  222.     on error resume next
  223.     cn.Execute(sql)
  224.     if err.Number <> 0 then
  225.         b_error = true
  226.         error_list.add "db_insert_edit_Links" & err.Number ,"The database insert failed. " & err.Description
  227.     else
  228.         set rs = cn.Execute("SELECT @@IDENTITY")
  229.         LinkID = rs(0)
  230.         rs.Close
  231.         msg_list.add "db_insert_edit_Links","The database insert was successful."    end if
  232.     on error goto 0
  233. end sub
  234. sub db_update_edit_Links
  235.     sql = "UPDATE Links SET " & _ 
  236.     "Ratings = " & to_sql(Ratings,"number") & ", " & _ 
  237.     "CatID = " & to_sql(CatID,"number") & ", " & _ 
  238.     "DateAdded = " & to_sql(DateAdded,"text") & ", " & _ 
  239.     "LinkTypeID = " & to_sql(LinkTypeID,"number") & ", " & _ 
  240.     "Title = " & to_sql(Title,"text") & ", " & _ 
  241.     "URL = " & to_sql(URL,"text") & ", " & _ 
  242.     "DownloadURL = " & to_sql(DownloadURL,"text") & ", " & _ 
  243.     "DownloadFee = " & to_sql(DownloadFee,"text") & ", " & _ 
  244.     "Description = " & to_sql(Description,"text") & ", " & _ 
  245.     "Email = " & to_sql(Email,"text") & ", " & _ 
  246.     "Priority = " & to_sql(Priority,"number") & ", " & _ 
  247.     "Impressions = " & to_sql(Impressions,"number") & ", " & _ 
  248.     "ClickThrus = " & to_sql(ClickThrus,"number") & ", " & _ 
  249.     "AvgRating = " & to_sql(AvgRating,"text") & ", " & _ 
  250.     "Display = " & to_sql(Display,"number") & " WHERE " & _ 
  251.     "LinkID = " & to_sql(LinkID,"number") & ""
  252.     'response.write sql
  253.     on error resume next
  254.     cn.execute(sql)
  255.     if err.number <> 0 then
  256.         b_error = true
  257.         error_list.add "db_update_edit_Links" & err.Number ,"The database update failed. " & err.Description
  258.     else
  259.         msg_list.add "db_update_edit_Links" & LinkID,"The database update was successful."
  260.     end if
  261.     on error goto 0
  262. end sub
  263. sub db_delete_edit_Links
  264.     sql = "DELETE FROM Links" & _ 
  265.     " WHERE " & _ 
  266.     "LinkID = " & to_sql(LinkID,"number") & ""
  267.     'response.write sql
  268.     on error resume next
  269.     cn.Execute(sql)
  270.     if err.number <> 0 then
  271.         b_error = true
  272.         error_list.add "db_delete_edit_Links" & err.Number ,"The database deletion failed. " & err.Description
  273.     else
  274.         msg_list.add "db_delete_edit_Links","The record was removed."
  275.     end if
  276.     on error goto 0
  277. end sub
  278. sub db_select_view_Links
  279.     view_Links_sql = "SELECT " & _ 
  280.     "AvgRating, " & _ 
  281.     "Cat, " & _ 
  282.     "ClickThrus, " & _ 
  283.     "Links.Description AS Description, " & _ 
  284.     "DownloadURL, " & _ 
  285.     "Email, " & _ 
  286.     "DateAdded, " & _ 
  287.     "Impressions, " & _ 
  288.     "LinkID, " & _ 
  289.     "LinkType, " & _ 
  290.     "Priority, " & _ 
  291.     "Ratings, " & _ 
  292.     "Title, " & _ 
  293.     "Display," & _ 
  294.     "URL FROM Cats, Links, LinkTypes WHERE Cats.CatID=Links.CatID AND  Links.LinkTypeID=LinkTypes.LinkTypeID"
  295.     if request("sortby") <> "" AND inStr(lcase(view_Links_sql),"order by") = 0 then view_Links_sql = view_Links_sql + " ORDER BY " & request("sortby")
  296. end sub
  297. sub db_update_view_Links
  298.     sql = "UPDATE Links SET Display = " & to_sql(Display,"number") & " WHERE LinkID = " & LinkID & ""
  299.     'response.write sql
  300.     on error resume next
  301.     cn.execute(sql)
  302.     if err.number <> 0 then
  303.         b_error = true
  304.         error_list.add "db_update_view_Links" & err.Number ,"The database update failed. " & err.Description
  305.     else
  306.         msg_list.add "db_update_view_Links" & LinkID,"The database update was successful."
  307.     end if
  308.     on error goto 0
  309. end sub
  310. sub db_delete_view_Links
  311.     sql = "DELETE FROM Links" & _ 
  312.     " WHERE " & _ 
  313.     "LinkID = " & to_sql(LinkID,"number") & ""
  314.     'response.write sql
  315.     on error resume next
  316.     cn.Execute(sql)
  317.     if err.number <> 0 then
  318.         b_error = true
  319.         error_list.add "db_delete_view_Links" & err.Number ,"The database deletion failed. " & err.Description
  320.     else
  321.         msg_list.add "db_delete_view_Links","The record was removed."
  322.     end if
  323.     on error goto 0
  324. end sub
  325.  
  326. do_search = request("do_search")
  327. ''' request form keys
  328. LinkID = request("LinkID")
  329. ''' request action
  330. action = lcase(request("action"))
  331. ''' action case handler
  332. select case action
  333.  
  334. case "select_edit_links"
  335. '  select the requested key record from database
  336. if LinkID <> "" then
  337.     db_select_edit_Links
  338. else
  339.     b_error = true
  340.     error_list.add "edit_edit_Links", "Specify record to select."
  341. end if
  342.  
  343.  
  344. case "insert_edit_links"
  345. '  request form data and insert a new record into database
  346.  
  347. validate_edit_links
  348. if not b_error then
  349.     db_insert_edit_links
  350. end if
  351.  
  352.  
  353.  
  354. case "update_edit_links"
  355. '  request form data and update an existing database record
  356. validate_edit_links
  357. if not b_error then
  358. if LinkID <> "" then
  359.     db_update_edit_links
  360. else
  361.     b_error = true
  362.     error_list.add "update_edit_links", "Specify record to update."
  363. end if
  364. end if
  365.  
  366.  
  367. case "delete_edit_links"
  368. '  delete the requested key database record
  369. if LinkID <> "" then
  370.     db_delete_edit_links
  371.     response.redirect request.servervariables("script_name") & "?msg=The+record+was+deleted."
  372. else
  373.     b_error = true
  374.     error_list.add "delete_edit_links", "Specify record to delete."
  375. end if
  376.  
  377.  
  378. case "update_view_links"'  request form data from edit grid to update existing database records
  379. '  this case is only created when a grid form's 'update' property is enabled
  380. for i = 1 to request.form("LinkID").count
  381.     Email = trim(request("Email")(i))
  382.     LinkID = trim(request("LinkID")(i))
  383.     URL = trim(request("URL")(i))
  384.     Display = trim(request("Display_" & i & ""))
  385.     db_update_view_links
  386. next
  387. response.redirect request.servervariables("script_name") & "?msg=The+database+was+updated."
  388.  
  389.  
  390. case "delete_view_links"'  request form data from edit grid to delete existing database records
  391. '  this case is only created when a grid form's 'update' property is enabled
  392. if LinkID <> "" then
  393.     db_delete_view_links
  394.     response.redirect request.servervariables("script_name") & "?msg=The+record+was+deleted."
  395. else
  396.     b_error = true
  397.     error_list.add "delete_view_links", "Specify record to delete."
  398. end if
  399.  
  400.  
  401. end select
  402.  
  403. '  no action was specified, so handle the default case(s)
  404. if LinkID <> "" then
  405.     db_select_edit_links
  406. end if
  407.  
  408. db_select_view_links
  409.  
  410. %>
  411.  
  412. <!-- #include file='i_header.asp' -->
  413. <!-- #include file='i_menu.asp' -->
  414.  
  415. <!-- #include file="i_menu_admin.asp" -->
  416. <%
  417. display_errs
  418. display_msg
  419. %>
  420.  
  421. <table class='headerTable'>
  422. <tr>
  423. <td class='headerTD'>
  424. <A href='admin_links.asp'>Link Manager</A>
  425. </td>
  426. </tr>
  427. </table>
  428. <table  >
  429. <form name="edit_Links" action="admin_links.asp" method="post" >
  430.         
  431.         <input type=hidden name="Ratings" value="<% =Ratings %>">
  432.         
  433.         
  434.         <input type=hidden name="LinkID" value="<% =LinkID %>">
  435.         
  436. <tr>
  437.     <td class='labelTD'>Category</td>
  438.     <td class='dataTD' >
  439.         
  440.         <select name="CatID" >
  441.         <option></option>
  442.         <%
  443.          =get_options ("SELECT Cats3.CatId, Cats.Cat, Cats1.Cat, Cats2.Cat, Cats3.Cat FROM (((Cats As Cats3 left JOIN Cats As Cats2 ON Cats3.ParentId = Cats2.CatId) left JOIN Cats As Cats1 ON Cats2.ParentId = Cats1.CatId) LEFT JOIN Cats As Cats ON Cats1.ParentId = Cats.CatId) WHERE Cats.ParentId is NULL order by (Cats.Cat & Cats1.Cat & Cats2.Cat & Cats3.Cat)", CatID) 
  444.         %>
  445.         </select>
  446.         
  447.     </td>
  448.     <td class='labelTD'>select the best category for this resource</td>
  449. </tr>
  450.         
  451.         <input type=hidden name="DateAdded" value="<% =DateAdded %>">
  452.         
  453. <tr>
  454.     <td class='labelTD'>Link Type <A href='admin_linktypes.asp'>?</A></td>
  455.     <td class='dataTD' >
  456.         
  457.         <select name="LinkTypeID" >
  458.         <option></option>
  459.         <%
  460.          =get_options ("SELECT LinkTypeID, LinkType FROM LinkTypes", LinkTypeID) 
  461.         %>
  462.         </select>
  463.         
  464.     </td>
  465.     <td class='labelTD'>select the type of resource</td>
  466. </tr>
  467. <tr>
  468.     <td class='labelTD'>Title</td>
  469.     <td class='dataTD' >
  470.         <input type=text  name="Title" size="" maxlength="60" value="<% =Title%>">
  471.     </td>
  472.     <td class='labelTD'>enter a title (upto 60 characters)</td>
  473. </tr>
  474. <tr>
  475.     <td class='labelTD'>URL</td>
  476.     <td class='dataTD' >
  477.         <input type=text  name="URL" size="" maxlength="120" value="<% =URL%>">
  478.     </td>
  479.     <td class='labelTD'>specify the URL, including http://, for the resource</td>
  480. </tr>
  481. <tr>
  482.     <td class='labelTD'>Download URL</td>
  483.     <td class='dataTD' >
  484.         <input type=text  name="DownloadURL" size="" maxlength="120" value="<% =DownloadURL%>">
  485.     </td>
  486.     <td class='labelTD'>specify the download URL if any</td>
  487. </tr>
  488. <tr>
  489.     <td class='labelTD'>Minumum Cost (if any)</td>
  490.     <td class='dataTD' >
  491.         <input type=text  name="DownloadFee" size="" maxlength="" value="<% =DownloadFee%>">
  492.     </td>
  493.     <td class='labelTD'></td>
  494. </tr>
  495. <tr>
  496.     <td class='labelTD'>Description</td>
  497.     <td class='dataTD' >
  498.         
  499.         <textarea  name="Description" rows='10' cols='60'><% =to_html(Description) %></textarea>
  500.         
  501.     </td>
  502.     <td class='labelTD'>enter a description for this resource (upto 1000 characters). This can include HTML code.</td>
  503. </tr>
  504. <tr>
  505.     <td class='labelTD'>Webmaster Email</td>
  506.     <td class='dataTD' >
  507.         <input type=text  name="Email" size="" maxlength="" value="<% =Email%>">
  508.     </td>
  509.     <td class='labelTD'></td>
  510. </tr>
  511. <tr>
  512.     <td class='labelTD'>Priority</td>
  513.     <td class='dataTD' >
  514.     <%
  515.     if not isnull(Priority) then
  516.          if (Priority < 1) AND (not Priority) then Priority = 0
  517.     else
  518.         Priority = 0
  519.     end if
  520.     %>
  521.         
  522.         <select name="Priority" >
  523.         <option></option>
  524.         <option <% if "3" = cStr(Priority) then %>selected<% end if %> value="3">low</option>
  525.         <option <% if "2" = cStr(Priority) then %>selected<% end if %> value="2">med</option>
  526.         <option <% if "1" = cStr(Priority) then %>selected<% end if %> value="1">high</option>
  527.         </select>
  528.         
  529.     </td>
  530.     <td class='labelTD'>select a priority -- used for ranking display in results list</td>
  531. </tr>
  532. <tr>
  533.     <td class='labelTD'>Impressions</td>
  534.     <td class='dataTD' >
  535.         <input type=text  name="Impressions" size="" maxlength="" value="<% =Impressions%>">
  536.     </td>
  537.     <td class='labelTD'># of times the resource has been viewed</td>
  538. </tr>
  539. <tr>
  540.     <td class='labelTD'>Clickthrus</td>
  541.     <td class='dataTD' >
  542.         <input type=text  name="ClickThrus" size="" maxlength="" value="<% =ClickThrus%>">
  543.     </td>
  544.     <td class='labelTD'># of times the related URL has been visited</td>
  545. </tr>
  546. <tr>
  547.     <td class='labelTD'>Your Rating</td>
  548.     <td class='dataTD' >
  549.         <% if isnull(AvgRating) then AvgRating = "" %>
  550.         
  551.         <select name="AvgRating" >
  552.         
  553.         <option <% if "1" = cStr(AvgRating) then %>selected<% end if %>>1</option>
  554.         <option <% if "2" = cStr(AvgRating) then %>selected<% end if %>>2</option>
  555.         <option <% if "3" = cStr(AvgRating) then %>selected<% end if %>>3</option>
  556.         <option <% if "4" = cStr(AvgRating) then %>selected<% end if %>>4</option>
  557.         <option <% if "5" = cStr(AvgRating) then %>selected<% end if %>>5</option>
  558.         <option <% if "6" = cStr(AvgRating) then %>selected<% end if %>>6</option>
  559.         <option <% if "7" = cStr(AvgRating) then %>selected<% end if %>>7</option>
  560.         <option <% if "8" = cStr(AvgRating) then %>selected<% end if %>>8</option>
  561.         <option <% if "9" = cStr(AvgRating) then %>selected<% end if %>>9</option>
  562.         <option <% if "10" = cStr(AvgRating) then %>selected<% end if %>>10</option>
  563.         </select>
  564.         
  565.     </td>
  566.     <td class='labelTD'>Select your 1(low) to 10(high) rating for this link.</td>
  567. </tr>
  568. <tr>
  569.     <td class='labelTD'>Display</td>
  570.     <td class='dataTD' >
  571.         <% if Display = "" then Display = false %>
  572.         <input type=checkbox  <% if Display then %>checked<% end if %> name="Display" value="1">
  573.     </td>
  574.     <td class='labelTD'>check box to approve this link for display</td>
  575. </tr>
  576. <tr>
  577.     <td class=labelTD align=right> 
  578.     <% if LinkID <> "" then %><input type=button name=new_button value='NEW LINK' onclick="window.location = '<% =request.servervariables("script_name") %>'"><% end if %>
  579.     </td>
  580.     <td class=dataTD>
  581.     <% if LinkID = "" then %><input type=submit name=insert_button value='ADD LINK'><% end if %>
  582.     <% if LinkID <> "" then %><input type=submit name=update_button value='UPDATE'><% end if %>
  583.     <% if LinkID <> "" then %><input type=submit name=delete_button value='DELETE' onclick="document.edit_Links.action.value = 'delete_edit_Links'"><% end if %>
  584.     </td>
  585.     <td class=labelTD> 
  586.     </td>
  587. <input type=hidden name="action" value="<% if LinkID <> "" then %>update<% else %>insert<%end if %>_edit_Links"></tr>
  588.  
  589. </form>
  590. </table>
  591.  
  592.  
  593. <%
  594.  
  595. page_no = request("page_no")
  596. if page_no = "" then page_no = 1
  597.  
  598. if view_Links_sql <> "" then
  599.     cmd.CommandText = view_Links_sql
  600.     rs.Filter = ""
  601.     rs.CursorLocation = 3
  602.     rs.CacheSize = 5
  603.     rs.Open cmd
  604.     if not rs.EOF then
  605.             rs.MoveFirst
  606.             rs.PageSize = 50
  607.             max_count = cInt(rs.PageCount)
  608.             num_recs = rs.RecordCount
  609.             rs.AbsolutePage = page_no
  610.             results = true
  611.     else
  612.         results = false
  613.         rs.Close
  614.     end if
  615. else
  616.     results = false
  617. end if
  618. rec_count = 0
  619.  
  620. %>
  621.  
  622. <%
  623.  
  624. if results = true then
  625.  
  626. %>
  627.  
  628. <table  >
  629. <form name="view_Links" action="admin_links.asp" method="post" >
  630. <tr>
  631.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Display" class=fieldFont title="">Approved</a></td>
  632.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Title" class=fieldFont title="">Title</a></td>
  633.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Cat" class=fieldFont title="">Category</a></td>
  634.     <td class='fieldTD'>Site</td>
  635.     <td class='fieldTD'>Email</td>
  636.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Description" class=fieldFont title="">Description</a></td>
  637.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=DateAdded" class=fieldFont title="">Added</a></td>
  638.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Priority" class=fieldFont title="">Priority</a></td>
  639.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=AvgRating" class=fieldFont title="">Rating</a></td>
  640.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=ClickThrus" class=fieldFont title="">Clicks</a></td>
  641.     <td class='fieldTD'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Impressions" class=fieldFont title="">Views</a></td>
  642. </tr>
  643. <%
  644.  
  645. do while not rs.EOF AND (rec_count < rs.Pagesize)
  646.  
  647. ':: read db record
  648. on error resume next
  649. Email = rs("Email")
  650. LinkID = rs("LinkID")
  651. URL = rs("URL")
  652. Display = rs("Display")
  653. Title = rs("Title")
  654. Cat = rs("Cat")
  655. Site = rs("Site")
  656. Send = rs("Send")
  657. Description = rs("Description")
  658. DateAdded = rs("DateAdded")
  659. Priority = rs("Priority")
  660. AvgRating = rs("AvgRating")
  661. ClickThrus = rs("ClickThrus")
  662. Impressions = rs("Impressions")
  663. on error goto 0
  664.  
  665. %>
  666.         
  667.         <input type=hidden name="Email" value="<% =Email %>">
  668.         
  669.         
  670.         <input type=hidden name="LinkID" value="<% =LinkID %>">
  671.         
  672.         
  673.         <input type=hidden name="URL" value="<% =URL %>">
  674.         
  675. <tr>
  676.     <td class='dataTD' >
  677.         <input type=checkbox <% if Display then %>checked<% end if %> name="Display_<% =rec_count+1 %>" value="<% =1 %>">
  678.     </td>
  679.     <td class='dataTD' >
  680.         <a href="admin_links.asp?LinkId=<% =LinkId %>"><% =Title %></a>
  681.     </td>
  682.     <td class='dataTD' >
  683.         <% =Cat %>
  684.     </td>
  685.     <td class='dataTD' >
  686.         <A href="<% =url %>" target="site_win">[launch]</A><% =Site %>
  687.     </td>
  688.     <td class='dataTD' >
  689.         <% if Email <> "" then %><A href="mailto:<% =email %>">[send]</A><% end if %><% =Send %>
  690.     </td>
  691.     <td class='dataTD' >
  692.         <% if description <> "" then description = left(server.htmlencode(description),40) %><% =Description %>...
  693.     </td>
  694.     <td class='dataTD' nowrap>
  695.         <% =DateAdded %>
  696.     </td>
  697.     <td class='dataTD' >
  698.         <% =Priority %>
  699.     </td>
  700.     <td class='dataTD' >
  701.         <% =AvgRating %>
  702.     </td>
  703.     <td class='dataTD' >
  704.         <% =ClickThrus %>
  705.     </td>
  706.     <td class='dataTD' >
  707.         <% =Impressions %>
  708.     </td>
  709. </tr>
  710. <%
  711.  
  712. rs.MoveNext
  713. rec_count = rec_count + 1
  714. loop
  715. rs.Close
  716.  
  717. %>
  718. <tr class=formtr>
  719.     <td class=dataTD align=right colspan=14>
  720.     <input type=submit name=update_button value=update>
  721.     </td>
  722. </tr>
  723. <input type=hidden name="action" value="update_view_links">
  724.  
  725. </form>
  726. </table>
  727. <%
  728.  
  729. else
  730.  
  731. %>
  732.  
  733.     
  734.  
  735. <%
  736.  
  737. end if
  738.  
  739. %>
  740.  
  741. <%
  742.  if max_count > 1 then 
  743. %>
  744.  
  745. <!-- paging footer -->
  746. <TABLE class=HeaderTable >
  747.     <tr>
  748.         <td width="20%" class=HeaderTD>
  749.             <% if page_no > 1 then %>
  750.             <a class=HeaderFont href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no-1 %>&sortby=<% =request("sortby") %>">PREV</a>
  751.             <% else %>            <% end if %>        </td>
  752.         <td align=center class=HeaderTD>
  753.             Page 
  754.             <% for i = 1 to max_count %>
  755.             <% if i = cint(page_no) then %>
  756.             <b><%=i%></b>
  757.             <% else %>
  758.             <a class=HeaderFont href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =i %>&sortby=<% =request("sortby") %>"><%=i%></a>
  759.             <% end if %>
  760.             <%next %>
  761.         </td>
  762.         <td align=right width="20%" class=HeaderTD>
  763.             <% if cInt(page_no) < cInt(max_count) then %>
  764.             <a class=HeaderFont href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no+1 %>&sortby=<% =request("sortby") %>">NEXT</a>
  765.             <% end if %>
  766.         </td>
  767.     </tr>
  768. </TABLE>
  769. <% end if %>
  770.  
  771.  
  772.  
  773.  
  774. <!-- #include file=i_footer.asp -->
  775.  
  776.  
  777. <%
  778. ':: assure that any db resources are freed
  779. on error resume next
  780. rs.Close
  781. set rs = NOTHING
  782. cn.Close
  783. set cn = NOTHING
  784. user_cn.Close
  785. set user_cn = NOTHING
  786. on error goto 0
  787. %>
  788.